<!DOCTYPE html>
<html>

	<head lang="en">
		<title>写私信</title>
		<meta charset="utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
		<link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
		<link rel="stylesheet" href="/css/reset.css"/>
		<link rel="stylesheet" href="/css/myStrategyComment.css"/>
		<link rel="stylesheet" href="/js/plugins/dialog/dialog.css">
		<script src="/js/jquery/jquery.min.js"></script>
		<script src="/js/bootstrap/js/bootstrap.js"></script>
		<script src="js/plugins/jquery_emoticon/js/jquery-1.11.0.min.js"></script>
		<script src="js/plugins/jquery_emoticon/js/jquery.mb.emoticons.js"></script>
		<script src="/js/plugins/jquery-form/jquery.form.js"></script>
		<script src="/js/plugins/dialog/dialog.min.js"></script>
		<script src="/js/common.js"></script>
		<script src="/js/plugins/raty/jquery.raty.js"></script>

	<script>
        $(function () {

            var beReview = getParams().id;//接收私信的人的id
            console.log(beReview);
            var href="/mine/userProfiles.html?id="+ beReview;//评论成功后的跳转链接

            //针对表单的属性配置
            var options = {
                type : "POST",
                url: "/users/letter",
                //在表单提交之前添加额外的参数,arr是要进行提交的参数的数组
                beforeSubmit: function(arr) {
                    arr.push({name:"message",value:$("[name=comment]").val()});//评论内容
                    arr.push({name:"receiveruserId",value:beReview})
                },
                //保存成功,跳转页面(我的游记页面)
                success: function(data) {
                    if(data.success){
                        //弹出窗口提示评价成功
                        $(document).dialog({
                            type : 'confirm',
                            style: 'IOS',
                            titleshow:false,
                            content: '私信发送成功',
                            buttons: [
                                {
                                    name: '确定',
                                    callback: function() {
                                        window.location.href="javascript:window.history.go(-1)";
                                    }
                                }
                            ]
                        });
                    } else{
                        $(document).dialog({
                            autoClose: 2500,
                            content: "回复失败，请再试一次！！"
                        })
                    }
                }
            };

            //将表单变为异步请求
            $(".content").ajaxForm(options);
            $("#submitBtn").click(function () {
                $(".content").submit();
            });

        })
	</script>
	</head>


	<body>
	<div class="search-head">
		<div class="row nav-search">
			<div class="col">
				<a href="javascript:window.history.go(-1)">
					<span><i class="fa fa-chevron-left"></i></span>
				</a>

			</div>
			<div class="col">
				<span>写私信</span>
			</div>
			<div class="col"></div>
		</div>
	</div>


	<div class="comment">
		<div class="content">
			<br>
			<textarea name="comment" id="comment" class="form-control" rows="5" placeholder="请填写你对ta的私信">
		</textarea>
			<button class="btn" onClick="$('#render').html($('#comment').val()).emoticonize(true).show()"><i class="fa fa-soccer-ball-o"> </i> 渲染</button>
			<div id="render" style="display:none"></div>
		</div>
		<br><br>
		<script type="text/javascript">
            $(function(){
                $("#comment").mbSmilesBox();
            })
		</script>
	</div>

	<div class="operation">
		<button class="btn" id="submitBtn">提交回复</button><button class="btn" onclick="window.history.go(-1)">放弃回复</button>
	</div>

	</body>


</html>